package com.hjm.project.agentInfo.agentPaid.service.impl;

import com.hjm.project.agentInfo.agentInfo.utils.Utils;
import com.hjm.project.agentInfo.agentPaid.domain.AgentPaid;
import com.hjm.project.agentInfo.agentPaid.mapper.AgentPaidMapper;
import com.hjm.project.agentInfo.agentPaid.service.IAgentPaidService;
import com.yxhd.encrypt.EncryptUtils;
import org.springframework.stereotype.Service;

import com.hjm.common.utils.text.Convert;

import javax.annotation.Resource;
import java.util.List;

/**
 * AgentPaidService业务层处理
 * 
 * @author maker-platform
 * @date 2021-03-22
 */
@Service
public class AgentPaidServiceImpl implements IAgentPaidService
{
    @Resource
    private AgentPaidMapper agentPaidMapper;

    /**
     * 查询AgentPaid
     * 
     * @param settleSerial AgentPaidID
     * @return AgentPaid
     */
    @Override
    public AgentPaid selectAgentPaidById(String settleSerial)
    {
        return agentPaidMapper.selectAgentPaidById(settleSerial);
    }

    /**
     * 查询AgentPaid列表
     * 
     * @param agentPaid AgentPaid
     * @return AgentPaid
     */
    @Override
    public List<AgentPaid> selectAgentPaidList(AgentPaid agentPaid) throws Exception {
        List<AgentPaid> agentPaids = agentPaidMapper.selectAgentPaidList(agentPaid);
        for (AgentPaid paid : agentPaids) {
            paid.setScreenNum(paid.getScreenNum() == null ? "" : Utils.hiddenCard(EncryptUtils.getDecrypt(paid.getScreenNum())));
        }
        return agentPaids;
    }
    /**
     * 新增AgentPaid
     * 
     * @param agentPaid AgentPaid
     * @return 结果
     */
    @Override
    public int insertAgentPaid(AgentPaid agentPaid)
    {
        return agentPaidMapper.insertAgentPaid(agentPaid);
    }

    /**
     * 修改AgentPaid
     * 
     * @param agentPaid AgentPaid
     * @return 结果
     */
    @Override
    public int updateAgentPaid(AgentPaid agentPaid)
    {
        return agentPaidMapper.updateAgentPaid(agentPaid);
    }

    /**
     * 删除AgentPaid对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAgentPaidByIds(String ids)
    {
        return agentPaidMapper.deleteAgentPaidByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除AgentPaid信息
     * 
     * @param settleSerial AgentPaidID
     * @return 结果
     */
    @Override
    public int deleteAgentPaidById(String settleSerial)
    {
        return agentPaidMapper.deleteAgentPaidById(settleSerial);
    }
}
